import { Query } from './utils'
import { LS_ACCESS_TOKEN_KEY, LS_USER_KEY, NOT_INITIALIZED_ERROR } from './constants'
// import jq from 'jquery'
// import {LS_ACCESS_TOKEN_KEY} from "./constants";
function Test() {
    const query = Query.parse();
    console.log(query);
    if (query.bkurl) {
        let jumpto = decodeURIComponent(query.bkurl);
        jumpto = decodeURIComponent(jumpto);
        if (query.code) {
            jumpto += "?code=" + query.code;
        }
        console.log(jumpto,localStorage.getItem(LS_USER_KEY));
        // setTimeout(e => {
        //     window.location.href = jumpto;
        // },10000);
    }
}
// function frameLoad() {
//     if (this.readyState && this.readyState != 'complete') return;
//     else {
//         alert(jq("pre").innerHTML);
//     }
//
// }
// function post(URL, PARAMS) {
//     let iframe = jq('<iframe  id="submitFrame" style="display: none;width:0; height:0" name="submitFrame"  src="about:blank"></iframe>')
//     iframe[0].onload = iframe[0].onreadystatechange = frameLoad;
//     document.body.appendChild(iframe[0]);
//
//     let temp = jq('<form id="themeForm" action="https://gitee.com/oauth/token"   method="post"  target="submitFrame"  enctype="multipart/form-data" >')[0];
//     temp.style.display = "none";
//     for (let x in PARAMS) {
//         let opt = document.createElement("textarea");
//         opt.name = x;
//         opt.value = PARAMS[x];
//         temp.appendChild(opt);
//     }
//     document.body.appendChild(temp);
//     temp.submit();
//     return temp;
// }

module.exports = Test